<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="renderer" content="webkit">
        <title>登录</title>
        <link href="__STATIC__/bootstrap/bootstrap.min.css" rel="stylesheet">
        <link href="__STATIC__/font-awesome/css/font-awesome.css" rel="stylesheet">
        <link href="__CSS__/animate.css" rel="stylesheet">
        <link href="__CSS__/style.css" rel="stylesheet">
    </head>
    <body class="gray-bg">
        <div class="middle-box text-center loginscreen  animated fadeInDown">
            <div>
                <div>
                    <h1 class="logo-name">7</h1>
                </div>
                <h3>prototype管理系统</h3>
                <form class="m-t" role="form" method="post" action="{:\\think\\Url::build('Login/login')}">
                    <div class="form-group">
                        <input type="text" name="username" class="form-control" placeholder="用户名" required="">
                    </div>
                    <div class="form-group">
                        <input type="password" name="password" class="form-control" placeholder="密码" required="">
                    </div>
                    <div class="input-group form-group">
                        <input type="text" name="verify" class="form-control" placeholder="验证码" required="">
                        <span class="input-group-btn">
                            <img style="cursor:pointer" class="mh5 verifyimg reloadverify" alt="点击刷新" src="{:\\think\\Url::build('Login/verify')}">
                        </span>
                    </div>
                    <button type="submit" class="btn btn-primary block full-width m-b">登 录</button>
                    <!--<p class="text-muted text-center"> <a href="login.html#"><small>忘记密码了？</small></a> | <a href="register.html">注册一个新账号</a>-->
                    </p>
                </form>
            </div>
        </div>
        <script type="text/javascript" src="__STATIC__/jquery/jquery-2.1.1.min.js"></script>
        <script type="text/javascript" src="__STATIC__/bootstrap/bootstrap.min.js"></script>
        <script type="text/javascript" src="__STATIC__/layer/layer.js"></script>
        <script type="text/javascript">
            $(function () {
                //刷新验证码
                var verifyimg = $(".verifyimg").attr("src");
                $(".reloadverify").click(function () {
                    if (verifyimg.indexOf('?') > 0) {
                        $(".verifyimg").attr("src", verifyimg + '&random=' + Math.random());
                    } else {
                        $(".verifyimg").attr("src", verifyimg.replace(/\?.*$/, '') + '?' + Math.random());
                    }
                });
                $("form").submit(function () {
                    $.post($(this).attr("action"), $(this).serialize(), function (data) {
                        if (data.code === 1) {
                            layer.msg(data.msg, {icon: 1, offset: 60, shift: 0});
                            setTimeout(function () {
                                window.location.href = data.url;
                            }, 1500);
                        } else {
                            layer.msg(data.msg, {icon: 0,offset: 60,shift: 0});
                            $(".reloadverify").click();//刷新验证码
                            $('input[name="verify"]').select();
                        }
                    });
                    return false;
                });
            });
            /*layer 弹出层*/
            layer.config({
                skin: 'layer-ext-espresso',
                extend: ['skin/espresso/style.css']
            });
        </script>
    </body>
</html>
